import 'package:excel_utils/extend/string_extend.dart';
import 'package:flutter/material.dart';

/// 月費計劃MonthlyPlan Widget
class MonthPlanWidget extends StatelessWidget {
  MonthPlanWidget({super.key});

   final List<Map<String, dynamic>> _plans = [
    {"type": "M1", "keda_count": 10, "month_price": 180, "excess_charge": 19, "excess_form": "On Call"},
    {"type": "M2", "keda_count": 20, "month_price": 340, "excess_charge": 18, "excess_form": "On Call"},
    {"type": "M3", "keda_count": 30, "month_price": 470, "excess_charge": 17, "excess_form": "A.M."},
    {"type": "M5", "keda_count": 50, "month_price": 730, "excess_charge": 16, "excess_form": "A.M.+P.M."},
    {"type": "M7", "keda_count": 70, "month_price": 950, "excess_charge": 15, "excess_form": "A.M.+P.M."},
    {"type": "M10", "keda_count": 100, "month_price": 1260, "excess_charge": 14, "excess_form": "A.M.+P.M."},
    {"type": "M15", "keda_count": 150, "month_price": 1730, "excess_charge": 13, "excess_form": "A.M.+P.M."},
  ];

  // 非核心工业区
  final List<Map<String, dynamic>> _plansNotZone = [
    {"type": "M1", "keda_count": 10, "month_price": 280, "excess_charge": 29, "excess_form": "On Call"},
    {"type": "M2", "keda_count": 20, "month_price": 540, "excess_charge": 28, "excess_form": "On Call"},
    {"type": "M3", "keda_count": 30, "month_price": 690, "excess_charge": 24, "excess_form": "A.M."},
    {"type": "M5", "keda_count": 50, "month_price": 1170, "excess_charge": 23, "excess_form": "A.M.+P.M."},
    {"type": "M7", "keda_count": 70, "month_price": 1390, "excess_charge": 20, "excess_form": "A.M.+P.M."},
    {"type": "M10", "keda_count": 100, "month_price": 1780, "excess_charge": 18, "excess_form": "A.M.+P.M."},
    {"type": "M15", "keda_count": 150, "month_price": 2250, "excess_charge": 16, "excess_form": "A.M.+P.M."},
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        margin: EdgeInsets.symmetric(horizontal: 20),
        child: Column(
          children: [
            Text("月費計劃MonthlyPlan*", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
            Row(
              children: [
                Container(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      Text("类型"),
                      Text("柯打數量"),
                      Text("月費價格"),
                      Text("超件收費"),
                      Text("收件形式"),
                      Text("操作"),
                    ],
                  ),
                ),
                Expanded(
                  child: Row(
                    children: [
                      ..._plans.map((plan) => Expanded(
                            child: Container(
                              margin: const EdgeInsets.symmetric(horizontal: 10),
                              child: Column(
                                children: [
                                  Text(plan["type"]),
                                  Text("${plan["keda_count"]}"),
                                  Text("${plan["month_price"]}"),
                                  Text("${plan["excess_charge"]}"),
                                  Text("${plan["excess_form"]}"),
                                  InkWell(
                                      onTap: () {
                                        "${plan["month_price"]}\t${plan["keda_count"]}\t${plan["excess_charge"]}".copyValue();
                                      },
                                      child: Text(
                                        "Copy",
                                        style: TextStyle(color: Colors.blue),
                                      ))
                                ],
                              ),
                            ),
                          ))
                    ],
                  ),
                )
              ],
            ),
            SizedBox(
              height: 20,
            ),
            Text("月費計劃MonthlyPlan*  非核心工業区", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
            Row(
              children: [
                Container(
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [Text("类型"), Text("柯打數量"), Text("月費價格"), Text("超件收費"), Text("收件形式"), Text("操作")],
                  ),
                ),
                Expanded(
                  child: Row(
                    children: [
                      ..._plansNotZone.map((plan) => Expanded(
                            child: Container(
                              margin: const EdgeInsets.symmetric(horizontal: 10),
                              child: Column(
                                children: [
                                  Text(plan["type"]),
                                  Text("${plan["keda_count"]}"),
                                  Text("${plan["month_price"]}"),
                                  Text("${plan["excess_charge"]}"),
                                  Text("${plan["excess_form"]}"),
                                  InkWell(
                                      onTap: () {
                                        "${plan["month_price"]}\t${plan["keda_count"]}\t${plan["excess_charge"]}".copyValue();
                                      },
                                      child: Text("Copy", style: TextStyle(color: Colors.blue)))
                                ],
                              ),
                            ),
                          ))
                    ],
                  ),
                )
              ],
            )
          ],
        ),
      ),
    );
  }
}
